#! /usr/bin/env lua
function check1 (num1, num2)
  local s1=tostring(num1)
  local s2=tostring(num2)
  for i in string.gmatch(s1,'.') do
    for j in string.gmatch(s2,'.') do
      if i==j then 
        return false
      end
    end
  end
  return true
end
function check2 (num1, num2)
  local n3=num2+num1
  return check1 (num1,num2) and check1(num2 ,n3) and check1(num1,n3)
end
function get_next(num1)
  local d=1
  while true do
    num2=num1+d
    if check2(num1,num2) then return num2 end
    d=d+1
  end
end
function get_lst()
  local d=1
  while true do
    print(d)
    d=get_next(d)
  end
end

get_lst()
